package com.yy.wga.merchant.service.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yy.wga.common.core.dto.Result;
import com.yy.wga.common.util.mapping.BeansUtils;
import com.yy.wga.common.web.intereceptor.RequestHolder;
import com.yy.wga.merchant.feign.api.MerchantPromotePosterFeign;
import com.yy.wga.merchant.feign.response.MerchantPromotePosterInfoResp;
import com.yy.wga.merchant.service.pojo.MerchantPromotePosterDO;
import com.yy.wga.merchant.service.service.MerchantPromotePosterService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;


/**
 * 推广海报
 *
 * @author guochao
 * @since 2024-11-10 21:11:05
 */
@Component
public class MerchantPromotePosterController implements MerchantPromotePosterFeign {
    @Resource
    private MerchantPromotePosterService merchantPromotePosterService;

    @Override
    public Result<MerchantPromotePosterInfoResp> get() {
        MerchantPromotePosterDO promotePoster = merchantPromotePosterService.getOne(new LambdaQueryWrapper<MerchantPromotePosterDO>()
                .eq(MerchantPromotePosterDO::getAppKey, RequestHolder.getBaseRequest().getAppKey()));
        return Result.success(BeansUtils.map(promotePoster, MerchantPromotePosterInfoResp.class));
    }
}
